{% extends "tools/base_tool.html" %}

{% block styles %}
<link rel="stylesheet" href="/static/css/photo-param-calculator.css">
{% endblock %}

{% block content %}
        
        <div class="row">
            <div class="col-md-6">
                <div class="card mb-4">
                    <div class="card-header bg-light">
                        <h3 class="card-title h5 mb-0">曝光值计算</h3>
                    </div>
                    <div class="card-body">
                        <form id="exposure-calculator">
                            <div class="mb-3">
                                <label for="aperture" class="form-label">光圈值 (f/)</label>
                                <select class="form-select" id="aperture">
                                    <option value="1.2">f/1.2</option>
                                    <option value="1.4">f/1.4</option>
                                    <option value="2">f/2</option>
                                    <option value="2.8">f/2.8</option>
                                    <option value="4">f/4</option>
                                    <option value="5.6">f/5.6</option>
                                    <option value="8">f/8</option>
                                    <option value="11">f/11</option>
                                    <option value="16">f/16</option>
                                    <option value="22">f/22</option>
                                </select>
                            </div>
                            <div class="mb-3">
                                <label for="shutter-speed" class="form-label">快门速度 (秒)</label>
                                <select class="form-select" id="shutter-speed">
                                    <option value="1/8000">1/8000</option>
                                    <option value="1/4000">1/4000</option>
                                    <option value="1/2000">1/2000</option>
                                    <option value="1/1000">1/1000</option>
                                    <option value="1/500">1/500</option>
                                    <option value="1/250">1/250</option>
                                    <option value="1/125">1/125</option>
                                    <option value="1/60">1/60</option>
                                    <option value="1/30">1/30</option>
                                    <option value="1/15">1/15</option>
                                    <option value="1/8">1/8</option>
                                    <option value="1/4">1/4</option>
                                    <option value="1/2">1/2</option>
                                    <option value="1">1</option>
                                    <option value="2">2</option>
                                    <option value="4">4</option>
                                    <option value="8">8</option>
                                    <option value="15">15</option>
                                    <option value="30">30</option>
                                    <option value="B">B门</option>
                                </select>
                            </div>
                            <div class="mb-3">
                                <label for="iso" class="form-label">ISO感光度</label>
                                <select class="form-select" id="iso">
                                    <option value="50">ISO 50 (扩展)</option>
                                    <option value="100">100</option>
                                    <option value="200">200</option>
                                    <option value="400">400</option>
                                    <option value="800">800</option>
                                    <option value="1600">1600</option>
                                    <option value="3200">3200</option>
                                    <option value="6400">6400</option>
                                    <option value="12800">12800</option>
                                    <option value="25600">25600</option>
                                    <option value="32000">32000</option>
                                    <option value="51200">51200</option>
                                    <option value="102400">102400 (扩展)</option>
                                </select>
                            </div>
                            <button type="button" class="btn btn-primary" id="calculate-ev">计算曝光值</button>
                        </form>
                        <div class="mt-3" id="exposure-result">
                            <div class="alert alert-info">
                                <p class="mb-0">曝光值 (EV): <span id="ev-value">-</span></p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            
            <div class="col-md-6">
                <div class="card mb-4">
                    <div class="card-header bg-light">
                        <h3 class="card-title h5 mb-0">景深计算器</h3>
                    </div>
                    <div class="card-body">
                        <form id="dof-calculator">
                            <div class="mb-3">
                                <label for="focal-length" class="form-label">焦距 (mm)</label>
                                <input type="number" class="form-control" id="focal-length" value="50">
                            </div>
                            <div class="mb-3">
                                <label for="dof-aperture" class="form-label">光圈值 (f/)</label>
                                <select class="form-select" id="dof-aperture">
                                    <option value="1.2">f/1.2</option>
                                    <option value="1.4">f/1.4</option>
                                    <option value="2">f/2</option>
                                    <option value="2.8">f/2.8</option>
                                    <option value="4">f/4</option>
                                    <option value="5.6">f/5.6</option>
                                    <option value="8">f/8</option>
                                    <option value="11">f/11</option>
                                    <option value="16">f/16</option>
                                    <option value="22">f/22</option>
                                </select>
                            </div>
                            <div class="mb-3">
                                <label for="subject-distance" class="form-label">{{ get_text('focus_distance', current_language) }}</label>
                                <input type="number" class="form-control" id="subject-distance" value="3">
                            </div>
                            <button type="button" class="btn btn-primary" id="calculate-dof">计算景深</button>
                        </form>
                        <div class="mt-3" id="dof-result">
                            <div class="alert alert-info">
                                <p class="mb-0">{{ get_text('near_limit', current_language) }} <span id="near-dof">-</span> 米</p>
                                <p class="mb-0">{{ get_text('far_limit', current_language) }} <span id="far-dof">-</span> 米</p>
                                <p class="mb-0">{{ get_text('total_dof', current_language) }} <span id="total-dof">-</span> 米</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
        <!-- 新增参数调节计算器 -->
        <div class="row">
            <div class="col-12">
                <div class="card mb-4">
                    <div class="card-header bg-light">
                        <h3 class="card-title h5 mb-0">参数调节计算器</h3>
                    </div>
                    <div class="card-body">
                        <p class="card-text">根据目标曝光值和已知参数，计算未知的摄影参数。</p>
                        <form id="param-calculator">
                            <div class="mb-3">
                                <label for="target-ev" class="form-label">目标曝光值 (EV)</label>
                                <input type="number" class="form-control" id="target-ev" value="10" step="0.1">
                            </div>
                            
                            <div class="mb-3">
                                <label for="param-to-calculate" class="form-label">要计算的参数</label>
                                <select class="form-select" id="param-to-calculate">
                                    <option value="aperture">光圈值</option>
                                    <option value="shutter">快门速度</option>
                                    <option value="iso">ISO感光度</option>
                                    <option value="nd">ND滤镜值</option>
                                </select>
                            </div>
                            
                            <div class="row">
                                <div class="col-md-6 mb-3" id="aperture-input-group">
                                    <label for="param-aperture" class="form-label">光圈值 (f/)</label>
                                    <select class="form-select" id="param-aperture">
                                        <option value="1.2">f/1.2</option>
                                        <option value="1.4">f/1.4</option>
                                        <option value="2">f/2</option>
                                        <option value="2.8">f/2.8</option>
                                        <option value="4">f/4</option>
                                        <option value="5.6">f/5.6</option>
                                        <option value="8">f/8</option>
                                        <option value="11">f/11</option>
                                        <option value="16">f/16</option>
                                        <option value="22">f/22</option>
                                    </select>
                                </div>
                                
                                <div class="col-md-6 mb-3" id="shutter-input-group">
                                    <label for="param-shutter" class="form-label">快门速度 (秒)</label>
                                    <select class="form-select" id="param-shutter">
                                        <option value="1/8000">1/8000</option>
                                        <option value="1/4000">1/4000</option>
                                        <option value="1/2000">1/2000</option>
                                        <option value="1/1000">1/1000</option>
                                        <option value="1/500">1/500</option>
                                        <option value="1/250">1/250</option>
                                        <option value="1/125">1/125</option>
                                        <option value="1/60">1/60</option>
                                        <option value="1/30">1/30</option>
                                        <option value="1/15">1/15</option>
                                        <option value="1/8">1/8</option>
                                        <option value="1/4">1/4</option>
                                        <option value="1/2">1/2</option>
                                        <option value="1">1</option>
                                        <option value="2">2</option>
                                        <option value="4">4</option>
                                        <option value="8">8</option>
                                        <option value="15">15</option>
                                        <option value="30">30</option>
                                        <option value="B">B门</option>
                                    </select>
                                </div>
                                
                                <div class="col-md-6 mb-3" id="iso-input-group">
                                    <label for="param-iso" class="form-label">ISO感光度</label>
                                    <select class="form-select" id="param-iso">
                                        <option value="50">ISO 50 (扩展)</option>
                                        <option value="100">100</option>
                                        <option value="200">200</option>
                                        <option value="400">400</option>
                                        <option value="800">800</option>
                                        <option value="1600">1600</option>
                                        <option value="3200">3200</option>
                                        <option value="6400">6400</option>
                                        <option value="12800">12800</option>
                                        <option value="25600">25600</option>
                                        <option value="32000">32000</option>
                                        <option value="51200">51200</option>
                                        <option value="102400">102400 (扩展)</option>
                                    </select>
                                </div>
                                
                                <div class="col-md-6 mb-3" id="nd-input-group">
                                    <label for="param-nd" class="form-label">ND滤镜值</label>
                                    <select class="form-select" id="param-nd">
                                        <option value="0">无 (ND0)</option>
                                        <option value="2">ND2 (减少1档)</option>
                                        <option value="4">ND4 (减少2档)</option>
                                        <option value="8">ND8 (减少3档)</option>
                                        <option value="16">ND16 (减少4档)</option>
                                        <option value="32">ND32 (减少5档)</option>
                                        <option value="64">ND64 (减少6档)</option>
                                        <option value="128">ND128 (减少7档)</option>
                                        <option value="256">ND256 (减少8档)</option>
                                        <option value="1000">ND1000 (减少10档)</option>
                                    </select>
                                </div>
                            </div>
                            
                            <button type="button" class="btn btn-primary" id="calculate-param">计算参数</button>
                        </form>
                        
                        <div class="mt-3" id="param-result">
                            <div class="alert alert-info">
                                <p class="mb-0">计算结果: <span id="param-value">-</span></p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
{% endblock %}

{% block scripts %}
<!-- 引入自定义脚本 -->
<script src="/static/js/photo-param-calculator.js"></script>
{% endblock %}